﻿// <copyright file="IModMatcher.cs" company="SingularityShift">
// Copyright (c) 2009 SingularityShift.com
// </copyright>
// <author>Ben McClure</author>
// <email>ben@singularityshift.com</email>
// <date>2009-08-14</date>
// <summary>A public interface which defines an object that matches one or more mods which are related to a parent mod in an undefined way</summary>
namespace GameLib.Games
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// <para>This interface represents an object which is meant to match against one or more IMods</para>
    /// <para>It can match against a particular mod id, or a pattern. This interface should be extended for various types of matching needs.</para>
    /// </summary>
    public interface IModMatcher : ICloneable
    {
        /// <summary>
        /// <para>Gets or sets the IMod which owns (is the parent of) this matcher.</para>
        /// <para>Generally, a matcher is designed to never match its owner.</para>
        /// </summary>
        IMod Owner
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the filename or file pattern against which this matcher matches.
        /// </summary>
        string FilePattern
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a usually-optional message regarding the match
        /// </summary>
        string Message
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a priority, usually defined as -1 to 100, which can be applied to a matcher to compare it against similar matchers.
        /// </summary>
        int Priority
        {
            get;
            set;
        }

        /// <summary>
        /// Gets a value indicating whether this matcher contains any useful information
        /// </summary>
        bool IsEmpty
        {
            get;
        }

        /// <summary>
        /// Determines whether this matcher matches any of the mods in the provided IModList
        /// </summary>
        /// <param name="modList">The list to check for matches against</param>
        /// <returns>A bool indicating whether or not there are matches in the list</returns>
        bool Matches<T>(IModCollection<T> modList) where T : IMod;

        /// <summary>
        /// Determines whether this matcher matches any of the mods in the provided IModList
        /// </summary>
        /// <param name="modList">The list to check for matches against</param>
        /// <param name="excludeMod">An IMod to exclude from matching</param>
        /// <returns>A bool indicating whether or not there are matches in the list</returns>
        bool Matches<T>(IModCollection<T> modList, IMod excludeMod) where T : IMod;

        /// <summary>
        /// Determines whether this matcher matches any of the mods in the provided IModList
        /// </summary>
        /// <param name="modList">The list to check for matches against</param>
        /// <param name="excludeMods">A list of mods to exclude from matching</param>
        /// <returns>A bool indicating whether or not there are matches in the list</returns>
        bool Matches<T>(IModCollection<T> modList, IModCollection<T> excludeMods) where T : IMod;

        /// <summary>
        /// Determines whether this matcher matches any of the mods in the provided IModList
        /// </summary>
        /// <param name="thisMod">The mod to check for a match against</param>
        /// <returns>A bool indicating whether or not the mod matches</returns>
        bool Matches(IMod thisMod);

        /// <summary>
        /// Returns a list of matching mods from the provided IModList
        /// </summary>
        /// <param name="modList">The IModList to check for matches against</param>
        /// <returns>An IList of matching IMod objects</returns>
        IModCollection<T> Match<T>(IModCollection<T> modList) where T : IMod;

        /// <summary>
        /// Returns a list of matching mods from the provided IModList
        /// </summary>
        /// <param name="modList">The IModList to check for matches against</param>
        /// <param name="excludeMod">An IMod to exclude from matching</param>
        /// <returns>An IList of matching IMod objects</returns>
        IModCollection<T> Match<T>(IModCollection<T> modList, IMod excludeMod) where T : IMod;

        /// <summary>
        /// Returns a list of matching mods from the provided IModList
        /// </summary>
        /// <param name="modList">The IModList to check for matches against</param>
        /// <param name="excludeMods">A list of mods to exclude from matching</param>
        /// <returns>An IList of matching IMod objects</returns>
        IModCollection<T> Match<T>(IModCollection<T> modList, IModCollection<T> excludeMods) where T : IMod;
    }
}